<!DOCTYPE>
<html>
<meta charset="utf-8"/>
<title>使用WebSocket协议对外提供服务</title>
<script src="http://cdn.bootcss.com/jquery/2.1.3/jquery.min.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
    var $URL = "__APP__/Home/GatewayWorker/bindUid";
    // 假设服务端ip为127.0.0.1
    ws = new WebSocket("ws://120.26.220.223:8384");
    ws.onopen = function() {
        alert("连接成功");
        ws.send('tom');
        alert("给服务端发送一个字符串：tom");
    };
    ws.onmessage = function(e) {
        alert("收到服务端的消息：" + e.data);
    };

</script>

<h2>使用WebSocket协议对外提供服务</h2>
</html>
